import React, { Component } from 'react'
import Three from './Three'

export default class Inject extends Component {
  state = {
    adress: '',
  }

  render() {
    let { adress } = this.state
    return (
      <div>
        姓名: <input ref={(v) => (this.nameEl = v)} type="text" /> <br />
        <br />
        地址: <Three adress={adress}></Three>
        <br />
        生日: <input ref={(v) => (this.birthEl = v)} type="date" /> <br />
        <br />
        是否接种: 是
        <input name="isInject" type="radio" ref={(v) => (this.yesEl = v)} /> 否
        <input name="isInject" type="radio" ref={(v) => (this.noEl = v)} />{' '}
        <br />
        <br />
        <br />
      </div>
    )
  }
  componentDidMount() {
    this.init()
    console.log(this.props.location.data)
    // this.birthEl.value
  }
  init = () => {
    if (!this.props.location.data) return
    let { name, birth, isFinish, adress } = this.props.location.data

    this.nameEl.value = name
    this.birthEl.value = birth

    if (isFinish) this.yesEl.checked = true
    else this.noEl.checked = true

    this.setState({
      adress,
    })
  }
}

// adress: "四川省 成都市 金牛区"
// birth: "1998-01-01"
// firstTime: "2021-09-08"
// id: 1
// isFinish: 0
// name: "小胡"
// nextTime: "2021-10-07"
